//
//  GJFPlotDetailImageTableViewCell.m
//  Wedding
//
//  Created by 郭静芬 on 2016/12/23.
//  Copyright © 2016年 郭静芬. All rights reserved.
//

#import "GJFPlotDetailImageTableViewCell.h"

@interface GJFPlotDetailImageTableViewCell ()
@property (nonatomic, strong) UIImageView *imageV;
@end

@implementation GJFPlotDetailImageTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;

        // 约束
        [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.contentView.mas_left).mas_offset(10 * XX);
            make.right.mas_equalTo(self.contentView.mas_right).mas_offset(-10 * XX);
            make.top.mas_equalTo(self.contentView.mas_top).mas_offset(5 * YY);
            make.bottom.mas_equalTo(self.contentView.mas_bottom).mas_offset(-5 * YY);
        }];
    }
    return self;
}

- (void)setImageUrl:(NSString *)imageUrl {
    _imageUrl = imageUrl;
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"占位图"]];
}

#pragma mark - 懒加载
- (UIImageView *)imageV {
    if (!_imageV) {
        _imageV = [[UIImageView alloc] init];
        _imageV.backgroundColor = [UIColor lightGrayColor];
        _imageV.contentMode = UIViewContentModeScaleAspectFill;
        _imageV.clipsToBounds = YES;
        [self.contentView addSubview:_imageV];
    }
    return _imageV;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
